<template>
  <div class="paymentSchedule">
    <section class="header clearfix">
      <span>缴纳进度</span>
    </section>
    <ul class="menu-swtich">
      <li
        v-for="(item, index) in menu"
        :key="index"
        :class="[switchIndex==index?'active':'']"
        @click="switchFun(index)"
      >{{item.title}}</li>
    </ul>
    <div class="table">
      <el-table
        :data="tableData"
        tooltip-effect="dark"
        v-loading="loading"
        style="width: 100%"
      >
        <el-table-column
          prop="name"
          fixed
          label="员工姓名"
          
        ></el-table-column>
        <el-table-column
          prop="phone"
          label="手机号"
          
        ></el-table-column>
        <el-table-column
          prop="cardNo"
          label="证件号"
          width="182"
          
        ></el-table-column>
        <el-table-column
          prop="city"
          label="城市"
          
        ></el-table-column>
        <el-table-column
          prop="censusRegisterType"
          label="户籍类型"
          :formatter="registerTypeFilter"
          
        ></el-table-column>
        <el-table-column
          prop="payYearMonth"
          label="帐单时间"
          
        ></el-table-column>
        <el-table-column
          prop="isSbFinished"
          label="办理状态(社保)"
          width="140"
          :formatter="finishFilter"
          
        ></el-table-column>
        <el-table-column
          label="办理状态(公积金)"
          width="140"
          
        >
          <template slot-scope="scope">
            <span v-if="scope.row.isSbFinished==1 || scope.row.isGjjFinished==1">-</span>
            <span v-else-if="scope.row.isGjjFinished==0">已完成</span>
          </template>
        </el-table-column>
        <el-table-column
          label="详情"
          fixed="right"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              @click="handleEdit(scope.$index, scope.row)"
            >查看</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="current"
        :page-sizes="[6,12, 24, 36]"
        :page-size="pageSize"
        layout="sizes, prev, pager, next"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
import base from "@/assets/js/base";
    import { requestApiPost } from '../api/api';
    import { reqRep } from '../report/reqReport';
    import { resRep } from "../report/resReport";
export default {
  name: "paymentSchedule",
  data() {
    return {
      loading: false,
      total: null,
      current: 1,
      pageSize: 6,
      switchIndex: 0,
      searchContent: "",
      jobStatus: 1,
      menu: [{ title: "在职", value: 1 }, { title: "离职", value: 3 }],
      tableData: []
    };
  },
  methods: {
    handleCurrentChange(e) {
      this.current = e;
      this.getData();
    },
    handleSizeChange(e) {
      this.pageSize = e;
      this.getData();
    },
    handleEdit(i, obj) {
      sessionStorage.setItem("urlParameter", 200);
      sessionStorage.setItem("userInfo", JSON.stringify(obj));
      setTimeout(() => {
        this.$router.push("paymentScheduleDetail");
      }, 200);
    },
    switchFun(i) {
      this.switchIndex = i;
      this.jobStatus = this.menu[i].value;
      this.current = 1;
      this.getData();
    },
    getData() {
      this.loading = true;
      this.tableData = [];
      base
        .getAjax("/bizUser/paymentSchedule", {
          companyId: JSON.parse(sessionStorage.getItem("login")).companyId,
          jobStatus: this.jobStatus,
          pageNum: this.current,
          pageSize: this.pageSize
        })
        .then(res => {
          this.loading = false;
          if (res.data.code == 1) {
            this.total = parseInt(resReport.data.total);
            this.tableData = res.data.data;
          } else {
            this.$message.error(res.data.message);
          }
        });
    },
    statusFilter(a, b, c) {
      if (c == 1) {
        return "帐单生成";
      } else {
        return "已经完成";
      }
    },
    finishFilter(a, b, c) {
      if (c == 1) {
        return "-";
      } else if (c == 0) {
        return "已完成";
      }
    },
    registerTypeFilter(a, b, c) {
      if (c == 1) {
        return "本地城镇";
      } else if (c == 2) {
        return "本地农村";
      } else if (c == 3) {
        return "外地城镇";
      } else if (c == 4) {
        return "外地农村";
      } else if (c == 5) {
        return "外籍人员";
      }
    }
  },
  created() {
    this.getData();
  }
};
</script>
<style scoped>
.header {
  padding: 15px;
  height: 50px;
  box-sizing: border-box;
  font-size: 14px;
  border-bottom: 1px solid #eee;
}
.header .org {
  float: right;
  cursor: pointer;
}
.org:hover {
  color: #13cb6e;
}
.header i {
  margin-right: 5px;
}
.opt-user {
  padding: 20px 15px;
}
.opt-user > section {
  display: inline-block;
  margin-right: 20px;
  cursor: pointer;
}
.opt-user i {
  font-size: 20px;
  margin-right: 5px;
  vertical-align: middle;
}
.opt-user .iconadd1 {
  color: #13cb6e;
}
.opt-user .iconbiaoge-xiazai {
  color: #33ac37;
}
.add-user:hover {
  color: #13cb6e;
}
.input-user:hover {
  color: #33ac37;
}
.menu-swtich {
  height: 50px;
  line-height: 50px;
  border-bottom: 1px solid #eee;
}
.menu-swtich li {
  display: inline-block;
  padding: 0 15px;
  cursor: pointer;
}
.active {
  color: #13cb6e;
  border-bottom: 2px solid #13cb6e;
}
.search-box {
  height: 50px;
  line-height: 50px;
}
.search-box i {
  font-size: 18px;
  margin-left: 15px;
  color: #999;
  vertical-align: middle;
}
.search-box .search {
  display: inline-block;
  width: 80%;
}
.showMoney {
  padding: 15px;
}
.showMoney .sm-h {
  margin-bottom: 40px;
}
.sm-h section {
  display: inline-block;
  margin-right: 20px;
}
.sm-h .month {
  margin-left: 10px;
  color: #999;
}
i {
  color: #999;
  font-size: 16px;
}
.download {
  float: right;
  font-size: 14px;
  margin-right: 0 !important;
}
.sm-f > ul {
  display: inline-block;
  width: 100px;
  margin-right: 15px;
  color: #666;
}
.sm-f .value {
  color: #666;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 5px;
}
.sm-f .button {
  float: right;
  width: 140px;
  text-align: center;
  height: 50px;
  font-size: 20px;
  line-height: 50px;
  color: #fff;
  border-radius: 4px;
  background-color: #13cb6e;
}
.table {
  margin-top: 4px;
}
.table .content {
  display: inline-block;
  border-right: 1px solid #ccc;
}
.table .content:last-child {
  border: none;
}
.table .content > section {
  padding: 10px 15px;
}
.table .content > section span {
  margin-right: 10px;
  display: inline-block;
  width: 80px;
  color: #999;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.table .content > section span:nth-child(2) {
  text-align: center;
}
.table .content > section span:last-child {
  margin-right: 0;
  text-align: center;
}
.rests {
  float: right;
}
</style>
